<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        function fun() {
            var data = [];

            return{
                add: function (obj){
                    data.push(obj);
                },
                remove: function () {
                    data.shift()
                },
                getData : function () {
                    
                    return data;
                }
            }
        }

        var num = fun();
        
        num.add(3);
        num.add(7);
        num.add(9);
        num.add(11);
        console.log(num.getData());
        num.remove();
        num.remove();
        console.log(num.getData());
        
        

    </script>
</body>
</html>